package com.chagee.channel.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 *
 * 源文件类型
 * @author yangyang
 * @date 2024/7/8 18:38
 */
@AllArgsConstructor
@Getter
public enum DocumentConversionSourceEnum {
    // Word文档
    DOC("doc"),
    DOCX("docx"),
    WPS("wps"),
    WPSS("wpss"),
    DOCM("docm"),
    DOTM("dotm"),
    DOT("dot"),
    DOTX("dotx"),
    HTML("html"),

    // PPT文档
    PPTX("pptx"),
    PPT("ppt"),
    POT("pot"),
    POTX("potx"),
    PPS("pps"),
    PPSX("ppsx"),
    DPS("dps"),
    DPT("dpt"),
    PPTM("pptm"),
    POTM("potm"),
    PPSM("ppsm"),
    DPSS("dpss"),

    // Excel文档
    XLS("xls"),
    XLT("xlt"),
    ET("et"),
    ETT("ett"),
    XLSX("xlsx"),
    XLTX("xltx"),
    CSV("csv"),
    XLSB("xlsb"),
    XLSM("xlsm"),
    XLTM("xltm"),
    ETS("ets"),

    // PDF文档
    PDF("pdf");


	private final String desc;

	public static boolean isWordDocument(String extension) {
		switch (extension.toLowerCase()) {
			case "doc":
			case "docx":
			case "wps":
			case "wpss":
			case "docm":
			case "dotm":
			case "dot":
			case "dotx":
			case "html":
				return true;
			default:
				return false;
		}
	}

	public static boolean isPowerPointDocument(String extension) {
		switch (extension.toLowerCase()) {
			case "pptx":
			case "ppt":
			case "pot":
			case "potx":
			case "pps":
			case "ppsx":
			case "dps":
			case "dpt":
			case "pptm":
			case "potm":
			case "ppsm":
			case "dpss":
				return true;
			default:
				return false;
		}
	}
}
